<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
	<meta name="robots" content="index, follow">
    <link rel="shortcut icon" type="image/png" href="favicon.png">

	<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css?9188" th:href="@{/css/bootstrap.min.css?9188}">
	<link rel="stylesheet" type="text/css" href="../static/css/style.css?8116" th:href="@{/css/style.css?8116}">
	<link rel="stylesheet" type="text/css" href="./css/animate.min.css?7456" th:href="@{/css/animate.min.css?7456}">
	<link href='https://fonts.googleapis.com/css?family=Josefin+Sans&display=swap&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900&display=swap&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
    <title>LoginIn</title>


    
<!-- Analytics -->
 
<!-- Analytics END -->
    
</head>
<body>

<!-- Main container -->
<div class="page-container">
    
<!-- bloc-5 -->
<div class="bloc bgc-azure bg1 full-width-bloc d-bloc" id="bloc-5">
	<div class="container bloc-sm">
		<div class="row">
			<div class="col">
				<nav class="navbar navbar-light row navbar-expand-md nav-invert link-style" role="navigation">
					<button id="nav-toggle" type="button" class="ui-navbar-toggler navbar-toggler border-0 p-0" data-toggle="collapse" data-target=".navbar-1893" aria-expanded="false" aria-label="Toggle navigation">
						<span class="navbar-toggler-icon"></span>
					</button>
					<div class="collapse navbar-collapse navbar-1893">
						<ul class="site-navigation nav navbar-nav">
							<li class="nav-item">
								<a href="loginup.html" th:href="@{/}" class="a-btn ltc-white">首页</a>
							</li>
							<li class="nav-item">
								<a href="loginup.html" th:href="@{/toRegister}" class="a-btn ltc-white">注册</a>
							</li>
						</ul>
					</div><a th:href="@{/}" class="navbar-brand mr-0 ltc-white link-style welcome animated zoomIn animDelay1" href="index.html">欢迎使用</a>
				</nav>
			</div>
		</div>
	</div>
</div>
<!-- bloc-5 END -->

<!-- bloc-6 -->
<div class="bloc l-bloc" id="bloc-6">
	<div class="container bloc-lg">
		<div class="row">
			<div class="col-sm-10 offset-sm-1 col-md-8 offset-md-2 col-lg-6 offset-lg-3">
				<form id="form_38623" data-form-type="blocs-form" novalidate data-success-msg="Your message has been sent." data-fail-msg="Sorry it seems that our mail server is not responding, Sorry for the inconvenience!">
					<div class="form-group">
						<label>
							用户名<br>
						</label>
						<input id="name_38623" class="form-control" required data-validation-required-message="请输入用户名。" placeholder="请输入用户名……" />
						<div style="color:red">
							<label v-show="usern">用户名不能为空!</label>
						</div>
					</div>
					<div class="form-group">
						<label>
							密码<br>
						</label>
						<input id="password_38623" class="form-control" type="password" required placeholder="请输入密码……" data-validation-required-message="请输入邮箱来注册。" />
						<div style="color:red">
							<label v-show="userp">密码不能为空</label>
						</div>
					</div> 
					<button v-on:click="login()" type="button" class="btn btn-lg btn-button-style btn-azure bloc-button">
						登录<br>
					</button>
				</form>
			</div>
		</div>
	</div>
</div>
<!-- bloc-6 END -->

<!-- ScrollToTop Button -->
<a class="bloc-button btn btn-d scrollToTop" onclick="scrollToTarget('1',this)"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 32 32"><path class="scroll-to-top-btn-icon" d="M30,22.656l-14-13-14,13"/></svg></a>
<!-- ScrollToTop Button END-->


<!-- bloc-2 -->
<div class="bloc l-bloc" id="bloc-2">
	<div class="container bloc-lg">
		<div class="row">
			<div class="col-12">
				<h5 class="mg-md text-lg-center">
					Thank ♥ You
				</h5>
				<p class="text-lg-center">
					Renxiang Jia,2024
				</p>
			</div>
		</div>
	</div>
</div>
<!-- bloc-2 END -->

</div>
<!-- Main container END -->

<!-- Additional JS -->
<script th:src="@{/js/bootstrap.bundle.min.js?1413}" src="./js/bootstrap.bundle.min.js?1413"></script>
<script th:src="@{/js/blocs.min.js?3842}" src="./js/blocs.min.js?3842"></script>
<script th:src="@{/js/jqBootstrapValidation.js}" src="./js/jqBootstrapValidation.js"></script>
<script th:src="@{/js/formHandler.js?2118}" src="./js/formHandler.js?2118"></script>
<script th:src="@{/js/lazysizes.min.js}" src="./js/lazysizes.min.js" defer></script>

<script th:src="@{/js/jquery.min.js}"  type="text/javascript" charset="utf-8"></script>
<script th:src="@{/js/vue.js}"  type="text/javascript" charset="utf-8"></script>
<script th:src="@{/js/axios.min.js}"  type="text/javascript" charset="utf-8"></script>

<!--js脚本，使用Vue框架-->
<script>
	var loginForm = new Vue({
		el:"#form_38623",  //作用范围：id=form_38623的标签及其内部
		//定义数据
		data: {
			//一些常量
			OK :200,
			ERROR:203,
		},
		data () {
			return {
				usern:false,
				userp:false,
			}
		},
		//定义方法
		methods: {
			//1.登录方法
			login:function () {
				var username = $("#name_38623").val();
				var password = $("#password_38623").val();
				this.usern = false;
				this.userp = false;

				if (username === "")
				{
					this.usern = true;
				}
				if (password === "")
				{
					this.userp = true;
				}

				axios({
					method: "get",
					url: "user/login/" + username +"/"+password
				})
						.then(function (value) {
							if(value.data.code === 200) {
								window.location.href = "toMe";
							}else{
								alert("用户名或密码错误");
							}
						})
						.catch();
			}
		}
	});
</script>


</body>
</html>
